import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JLabel;
import javax.swing.JButton;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

public class MainMenu extends JFrame {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3844580071859444909L;
	private JPanel contentPane;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					MainMenu frame = new MainMenu();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public MainMenu() {
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setTitle("Main Menu");
		setBounds(100, 100, 500, 250);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(null);
		
		JLabel lblDpssSystems = new JLabel("DPSS SYSTEMS - Main Menu");
		lblDpssSystems.setBounds(153, 21, 200, 14);
		contentPane.add(lblDpssSystems);
		
		JButton btnManageIncome = new JButton("Manage Income");
		btnManageIncome.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			
				dispose();
			
				IncomeScreen page=new IncomeScreen(); // Open the next page..
	            page.setVisible(true); // Makes the next page visible
	            
			}
		});
		btnManageIncome.setBounds(26, 73, 210, 23);
		contentPane.add(btnManageIncome);
		
		
		JButton btnManageExpenditure = new JButton("Manage Expenditure");
		btnManageExpenditure.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			
				dispose();
			
				ManageExpenditure expenditurePage=new ManageExpenditure(); // Open the next page..
	            expenditurePage.setVisible(true); // Makes the next page visible
	            
			}
		});
		btnManageExpenditure.setBounds(255, 73, 210, 23);
		contentPane.add(btnManageExpenditure);
		
		JButton btnPlotGraph = new JButton("Plot Graph");
		btnPlotGraph.setBounds(26, 116, 210, 23);
		contentPane.add(btnPlotGraph);
		btnPlotGraph.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			
				dispose();
			
				PlotGraph graphPage =new PlotGraph(); // Open the next page..
				graphPage.setVisible(true); // Makes the next page visible
	            
			}
		});
		
		JButton btnCompareSupermarkets = new JButton("Compare Supermarkets");
		btnCompareSupermarkets.setBounds(255, 116, 210, 23);
		contentPane.add(btnCompareSupermarkets);
		btnCompareSupermarkets.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			
				dispose();
			
				PriceChecker page=new PriceChecker(); // Open the next page..
	            page.setVisible(true); // Makes the next page visible
			}
		});
		
		JButton btnLogout = new JButton("Logout");
		btnLogout.setBounds(174, 158, 145, 23);
		contentPane.add(btnLogout);
		btnLogout.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent arg0) {
			
				dispose();
			
				Login page=new Login(); // Open the next page..
	            page.setVisible(true); // Makes the next page visible
	            JOptionPane.showMessageDialog(null, "Goodbye!");
			}
		});
	}

}